package common.BaseView
{
	import com.liangzhong.constants.TipsConst;
	import com.lz.football.module.base.IComponent;
	
	import flash.display.DisplayObject;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.utils.Dictionary;
	
	import lz.controls.managers.TipsManager;
	
	public class DisplayMouseEventManager
	{
		private static var _instance:DisplayMouseEventManager;
		private var _dic:Dictionary;
		public function DisplayMouseEventManager()
		{
		}
		
		public static function get instance():DisplayMouseEventManager
		{
			if(_instance == null)_instance = new DisplayMouseEventManager();
			return _instance;
		}
		/**
		 *增加tips 
		 * @param $display
		 * @param $data
		 * 
		 */
		public function addTipsDisplay($display:DisplayObject,$data:Object):void
		{
			if(_dic == null)_dic = new Dictionary();
			if(!_dic.hasOwnProperty($display))
			{
				$display.addEventListener(MouseEvent.ROLL_OUT,onOutHandler);
				$display.addEventListener(MouseEvent.ROLL_OVER,onOverHandler);
			}
			_dic[$display] = $data;
			
		}
		protected function onOverHandler(event:MouseEvent):void
		{
			var display:DisplayObject = event.target as DisplayObject;
			var data:Object = _dic[display];
			if (data is String)
			{
				TipsManager.show(TipsConst.BASETIPS,{tip:data as String},15,15,true,true);
					
			}
		}
		protected function onOutHandler(event:MouseEvent):void
		{
			TipsManager.hide();
		}
		/**
		 * 移除
		 * 
		 */
		public function removeTipsDisplay($display:DisplayObject):void
		{
			if($display == null)return;
			if(_dic.hasOwnProperty($display))
			{
				
			}
			$display.removeEventListener(MouseEvent.ROLL_OUT,onOutHandler);
			$display.removeEventListener(MouseEvent.ROLL_OVER,onOverHandler);
			delete _dic[$display];
		}
	}
}